<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>职称配置列表</a></li>
        <li><a href="{:url('AdminOauth/dutyForm')}">添加职称</a></li>
    </ul>
    <form method="post" class="js-ajax-form margin-top-20">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th >ID</th>
                <th>职称</th>
                <th>会议权限</th>
                <th>直播权限</th>
                <th>创建时间</th>
                <th>修改时间</th>
                <th align="center">{:lang('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="list" item="vo">
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.duty}</td>
                    <td>
                        <if condition="$vo.is_meeting eq 1">
                            <a data-toggle="tooltip" title="有"><i class="fa fa-check"></i></a>
                        <else />
                            <a data-toggle="tooltip" title="无"><i class="fa fa-close"></i></a>
                        </if>
                    </td>
                    <td>
                        <if condition="$vo.is_straming eq 1">
                            <a data-toggle="tooltip" title="有"><i class="fa fa-check"></i></a>
                        <else />
                            <a data-toggle="tooltip" title="无"><i class="fa fa-close"></i></a>
                        </if>
                    </td>
                    <td>{$vo.create_time}</td>
                    <td>{$vo.update_time}</td>
                    <td>
                        <a href="{:url('adminOauth/dutyForm',array('id'=>$vo['id']))}">编辑</a>
                        <a href="#" onclick="dutyDetele({$vo['id']})">删除</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>

    // 删除
    function dutyDetele(id){

        art.dialog({
            title: false,
            icon: 'question',
            content: '确定删除？',
            okVal: "确定",
            ok: function () {
                 $.ajax({
                    url: "{:url('AdminOauth/dutyDelete')}",
                    dataType: 'json',
                    data: {'id':id},
                    type: "POST",
                    success: function(data){
                        if (data.code == '1') {
                            noty({
                                text: data.msg,
                                type: 'success',
                                layout: 'topCenter',
                                modal: true,
                                timeout: 800,
                                callback: {
                                    afterClose: function () {
                                        if (data.url) {
                                            //返回带跳转地址
                                            window.location.href = data.url;
                                        } else {
                                            //刷新当前页
                                            reloadPage(window);
                                        }
                                    }
                                }
                            }).show();
                        } else if (data.code == '0') {
                            art.dialog({
                                content: data.msg,
                                icon: 'warning',
                                ok: function () {
                                    this.title(data.msg);
                                    return true;
                                }
                            });
                        }
                    }
                });
            },
            cancelVal: '关闭',
            cancel: true
        });
    }
</script>
</body>
</html>